package com.zhentao.service.impl;

import com.zhentao.service.MinioService;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
@Service
public class MinioServiceImpl implements MinioService {
    @Autowired
    private FileServiceImpl fileStorageService;

    @SneakyThrows
    @Override
    public String upload(MultipartFile multipartFile) {
        if (multipartFile==null || multipartFile.isEmpty()){
            return "文件不能为空";
        }
        String bz = multipartFile.getOriginalFilename();
            String chuan = fileStorageService.uploadImage(bz, multipartFile.getInputStream());
            System.out.println(chuan);
            return "上传成功";
    }
}
